<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public static function json($data) {
        return response()->json($data);
    }

    public static function success($data = null, $code = 200, $msg = 'success') {
        return self::json(['code' => $code, 'message' => $msg, 'data' => $data]);
    }

    public static function fail($code, $msg) {
        return self::json(['code' => $code, 'message' => $msg]);
    }
}
